package com.binyouwei.designpatterns.behavior.visitor;


/**
 * @author 宾有为
 * Created on 2024/7/15 22:41
 * Social homepage: https://blog.csdn.net/baidu_41616022
 * @desc
 **/
public class VisitorPerimeterCalculator  implements VisitorShapeVisitor {
    @Override
    public void visit(VisitorCircle circle) {
        System.out.println("Circle perimeter: " + 2 * Math.PI * circle.getRadius());
    }

    @Override
    public void visit(VisitorRectangle rectangle) {
        System.out.println("Rectangle perimeter: " + 2 * (rectangle.getWidth() + rectangle.getHeight()));
    }
}
